home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d21 / mscdvint.arc / MSCDVINT.ASM < prev    next >
Assembly Source File  |  1988-10-01  |  3KB  |  132 lines

  1.  
  2.     NAME    DVINT
  3.     TITLE    DESQview Interfaces
  4.     PAGE    66,132
  5.  
  6.      ; altered for use with MS-C v3.0
  7.      ; underscores in front of the functions
  8.      ; and DVINT_SEG is now _TEXT for small memory models
  9.  
  10. _TEXT SEGMENT 'CODE'
  11.     ASSUME    CS:_TEXT
  12.  
  13.     PUBLIC    _DV_GET_VERSION
  14.     PUBLIC    _DV_PAUSE
  15.     PUBLIC    _DV_BEGIN_CRITICAL
  16.     PUBLIC    _DV_END_CRITICAL
  17.     PUBLIC    _DV_GET_VIDEO_BUFFER
  18.  
  19. IN_DV    DB 1
  20.  
  21. GET_VERSION PROC
  22.     PUSH    BX
  23.     PUSH    CX
  24.     PUSH    DX
  25.     MOV    AX,2B01H        ; DV get version request
  26.     MOV    CX,'DE'
  27.     MOV    DX,'SQ'
  28.     INT    21H
  29.     CMP    AL,0FFH            ; Are we in DV?
  30.     JE    NO_DV            ; Jump if not
  31.     MOV    AX,BX            ; We are; put the version number in AX
  32.     MOV    CS:IN_DV,1        ; Set the local IN_DV flag
  33.     JMP    SHORT DVGV_EXIT
  34. NO_DV:    SUB    AX,AX            ; Clear AX
  35.     MOV    CS:IN_DV,AL        ; And the local flag
  36. DVGV_EXIT:
  37.     POP    DX
  38.     POP    CX
  39.     POP    BX
  40.     RET
  41. GET_VERSION ENDP
  42.  
  43. ; _DV_GET_VERSION returns the DV version number in AX, or 0 if not in
  44. ; DV.  This should be called before any other DV functions
  45. _DV_GET_VERSION PROC FAR
  46.     CALL    GET_VERSION
  47.     RET
  48. _DV_GET_VERSION ENDP
  49.  
  50. ; API_CALL is a local routine that goes on stack, does whatever call is
  51. ; passed it in BX, and then goes off stack
  52. API_CALL PROC
  53.     PUSH    AX
  54.     MOV    AX,101AH
  55.     INT    15H            ; OSTACK
  56.     MOV    AX,BX
  57.     INT    15H            ; Parameter
  58.     MOV    AX,1025H
  59.     INT    15H            ; USTACK
  60.     POP    AX
  61.     RET
  62. API_CALL ENDP
  63.  
  64. ; _DV_PAUSE gives up the rest of its time slice when called
  65. _DV_PAUSE PROC FAR
  66.     CMP    CS:IN_DV,1        ; Are we in DV?
  67.     JNE    DVP_END            ; Jump if not
  68.     PUSH    BX
  69.     MOV    BX,1000H        ; PAUSE function call
  70.     CALL    API_CALL
  71.     POP    BX
  72. DVP_END:
  73.     RET
  74. _DV_PAUSE ENDP
  75.  
  76. ; Begins a critical region.  This is a section of code which DV will not
  77. ; slice out of.  It MUST be ended with a _DV_END_CRITICAL call.
  78. _DV_BEGIN_CRITICAL PROC FAR
  79.     CMP    CS:IN_DV,1        ; Are we in DV?
  80.     JNE    DVBC_END        ; Jump if not
  81.     PUSH    BX
  82.     MOV    BX,101BH        ; BEGINC
  83.     CALL    API_CALL
  84.     POP    BX
  85. DVBC_END:
  86.     RET
  87. _DV_BEGIN_CRITICAL ENDP
  88.  
  89. ; Ends a critical region.
  90. _DV_END_CRITICAL PROC FAR
  91.     CMP    CS:IN_DV,1        ; Are we in DV?
  92.     JNE    DVEC_END        ; Jump if not
  93.     PUSH    BX
  94.     MOV    BX,101CH        ; ENDC
  95.     CALL    API_CALL
  96.     POP    BX
  97. DVEC_END:
  98.     RET
  99. _DV_END_CRITICAL ENDP
  100.  
  101. ; Passed on the stack the video buffer address to use outside of DV.
  102. ; Returns the video buffer address to use instead.
  103. ; If what it returns is different, then video synching is not necessary.
  104. ; Also, this call does a _DV_GET_VERSION call itself, so if you get
  105. ; the video buffer, it is not required that you get the version.
  106. _DV_GET_VIDEO_BUFFER PROC FAR
  107.     PUSH    BP
  108.     MOV    BP,SP
  109.     PUSH    BX
  110.     PUSH    DI
  111.     PUSH    ES
  112.     MOV    ES,[BP+6]        ; Put the starting segment in ES
  113.     CALL    GET_VERSION
  114.     TEST    AX,AX            ; Are we in DESQview?
  115.     JZ    DVGVB_END        ; Jump if not
  116.     SUB    DI,DI            ; Clear DI
  117.     MOV    AH,0FEH            ; Get video buffer function call
  118.     INT    10H
  119. DVGVB_END:
  120.     MOV    AX,ES
  121.     POP    ES
  122.     POP    DI
  123.     POP    BX
  124.     POP    BP
  125.     RET    2
  126. _DV_GET_VIDEO_BUFFER ENDP
  127.  
  128. _TEXT ENDS
  129.  
  130.     END
  131. 
  132.